import { getTabelList } from '~/api/usally/index'
import { getByCode } from '~/api/basicConfig/index'

export const state = () => ({
  footers: [],
  navs: [],
  header: []
})

export const mutations = {
  setFooter(state, footers) {
    state.footers = footers
  },
  setNavs(state, navs) {
    state.navs = navs
  }
}

export const actions = {
  async loadFooters(context) {
    const data = await getByCode({
      classifyCode: 'footer'
    })
    context.commit('setFooter', data.data.basicItems)
  },
  async loadNavs(context) {
    const data = {
      page: 0,
      size: 10,
      status: 'up'
    }
    const url = '/navigator'
    const resp = await getTabelList({
      data,
      url
    })
    context.commit('setNavs', resp.data.content)
  }
}
